home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / MachineExceptions.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  3.9 KB  |  174 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MachineExceptions.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT MachineExceptions;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __MACHINEEXCEPTIONS__}
  27. {$SETC __MACHINEEXCEPTIONS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC MachineExceptionsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.     
  43. TYPE
  44.     AreaID = KernelID;
  45.  
  46. { Machine Dependent types for PowerPC: }
  47.     MachineInformationPowerPC = RECORD
  48.         CTR:                    UnsignedWide;
  49.         LR:                        UnsignedWide;
  50.         PC:                        UnsignedWide;
  51.         CR:                        LONGINT;
  52.         XER:                    LONGINT;
  53.         MSR:                    LONGINT;
  54.     END;
  55.     RegisterInformationPowerPC = RECORD
  56.         R0:                        UnsignedWide;
  57.         R1:                        UnsignedWide;
  58.         R2:                        UnsignedWide;
  59.         R3:                        UnsignedWide;
  60.         R4:                        UnsignedWide;
  61.         R5:                        UnsignedWide;
  62.         R6:                        UnsignedWide;
  63.         R7:                        UnsignedWide;
  64.         R8:                        UnsignedWide;
  65.         R9:                        UnsignedWide;
  66.         R10:                    UnsignedWide;
  67.         R11:                    UnsignedWide;
  68.         R12:                    UnsignedWide;
  69.         R13:                    UnsignedWide;
  70.         R14:                    UnsignedWide;
  71.         R15:                    UnsignedWide;
  72.         R16:                    UnsignedWide;
  73.         R17:                    UnsignedWide;
  74.         R18:                    UnsignedWide;
  75.         R19:                    UnsignedWide;
  76.         R20:                    UnsignedWide;
  77.         R21:                    UnsignedWide;
  78.         R22:                    UnsignedWide;
  79.         R23:                    UnsignedWide;
  80.         R24:                    UnsignedWide;
  81.         R25:                    UnsignedWide;
  82.         R26:                    UnsignedWide;
  83.         R27:                    UnsignedWide;
  84.         R28:                    UnsignedWide;
  85.         R29:                    UnsignedWide;
  86.         R30:                    UnsignedWide;
  87.         R31:                    UnsignedWide;
  88.     END;
  89.     FPUInformationPowerPC = RECORD
  90.         Registers:                ARRAY [0..31] OF UnsignedWide;
  91.         FPSCR:                    LONGINT;
  92.         Reserved:                LONGINT;
  93.     END;
  94.  
  95. CONST
  96.     writeReference                = 0;
  97.     readReference                = 1;
  98.     fetchReference                = 2;
  99.  
  100.     
  101. TYPE
  102.     MemoryReferenceKind = LONGINT;
  103.  
  104.     MemoryExceptionInformation = RECORD
  105.         theArea:                AreaID;
  106.         theAddress:                LogicalAddress;
  107.         theError:                OSStatus;
  108.         theReference:            MemoryReferenceKind;
  109.     END;
  110.  
  111. CONST
  112.     unknownException            = 0;
  113.     illegalInstructionException    = 1;
  114.     trapException                = 2;
  115.     accessException                = 3;
  116.     unmappedMemoryException        = 4;
  117.     excludedMemoryException        = 5;
  118.     readOnlyMemoryException        = 6;
  119.     unresolvablePageFaultException = 7;
  120.     privilegeViolationException    = 8;
  121.     traceException                = 9;
  122.     instructionBreakpointException = 10;
  123.     dataBreakpointException        = 11;
  124.     integerException            = 12;
  125.     floatingPointException        = 13;
  126.     stackOverflowException        = 14;
  127.     terminationException        = 15;
  128.  
  129.     
  130. TYPE
  131.     ExceptionKind = LONGINT;
  132.  
  133.     ExceptionInfo = RECORD
  134.         CASE INTEGER OF
  135.         0: (
  136.             memoryInfo:                    ^MemoryExceptionInformation;
  137.            );
  138.     END;
  139.     ExceptionInformationPowerPC = RECORD
  140.         theKind:                ExceptionKind;
  141.         machineState:            ^MachineInformationPowerPC;
  142.         registerImage:            ^RegisterInformationPowerPC;
  143.         FPUImage:                ^FPUInformationPowerPC;
  144.         info:                    ExceptionInfo;
  145.     END;
  146. {$IFC GENERATINGPOWERPC }
  147.     ExceptionInformation = ExceptionInformationPowerPC;
  148.  
  149.     MachineInformation = MachineInformationPowerPC;
  150.  
  151.     RegisterInformation = RegisterInformationPowerPC;
  152.  
  153.     FPUInformation = FPUInformationPowerPC;
  154.  
  155. {$ENDC}
  156. { Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  157.             It must be a native function pointer with NO routine descriptor. }
  158.     ExceptionHandler = ProcPtr;  { FUNCTION (VAR theException: ExceptionInformationPowerPC): OSStatus; }
  159.  
  160. { Routine for installing per-process exception handlers }
  161.  
  162. FUNCTION InstallExceptionHandler(theHandler: ExceptionHandler): ExceptionHandler;
  163.  
  164. {$ALIGN RESET}
  165. {$POP}
  166.  
  167. {$SETC UsingIncludes := MachineExceptionsIncludes}
  168.  
  169. {$ENDC} {__MACHINEEXCEPTIONS__}
  170.  
  171. {$IFC NOT UsingIncludes}
  172.  END.
  173. {$ENDC}
  174.